<?php echo $header; ?><?php echo $column_left; ?><?php echo $column_right; ?>
<div id="content"><?php echo $content_top; ?>
  <!--div class="breadcrumb">
    <?php foreach ($breadcrumbs as $breadcrumb) { ?>
    <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
    <?php } ?>
  </div-->
  <!--h1><?php echo $heading_title; ?></h1-->
  <?php /*if ($thumb || $description) { ?>
  <div class="category-info">
    <?php if ($thumb) { ?>
    <div class="image"><img src="<?php echo $thumb; ?>" alt="<?php echo $heading_title; ?>" /></div>
    <?php } ?>
    <?php if ($description) { ?>
    <?php echo $description; ?>
    <?php } ?>
  </div>
  <?php }*/ ?>
  <?php /*if ($categories) { ?>
  <h2><?php echo $text_refine; ?></h2>
  <div class="category-list">
    <?php if (count($categories) <= 5) { ?>
    <ul>
      <?php foreach ($categories as $category) { ?>
      <li><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a></li>
      <?php } ?>
    </ul>
    <?php } else { ?>
    <?php for ($i = 0; $i < count($categories);) { ?>
    <ul>
      <?php $j = $i + ceil(count($categories) / 4); ?>
      <?php for (; $i < $j; $i++) { ?>
      <?php if (isset($categories[$i])) { ?>
      <li><a href="<?php echo $categories[$i]['href']; ?>"><?php echo $categories[$i]['name']; ?></a></li>
      <?php } ?>
      <?php } ?>
    </ul>
    <?php } ?>
    <?php } ?>
  </div>
  <?php }*/ ?>
  <?php if ($products) { ?>
  <!--div class="product-filter">
    <div class="display"><b><?php echo $text_display; ?></b> <?php echo $text_list; ?> <b>/</b> <a onclick="display('grid');"><?php echo $text_grid; ?></a></div>
    <div class="limit"><b><?php echo $text_limit; ?></b>
      <select onchange="location = this.value;">
        <?php foreach ($limits as $limits) { ?>
        <?php if ($limits['value'] == $limit) { ?>
        <option value="<?php echo $limits['href']; ?>" selected="selected"><?php echo $limits['text']; ?></option>
        <?php } else { ?>
        <option value="<?php echo $limits['href']; ?>"><?php echo $limits['text']; ?></option>
        <?php } ?>
        <?php } ?>
      </select>
    </div>
    <div class="sort"><b><?php echo $text_sort; ?></b>
      <select onchange="location = this.value;">
        <?php foreach ($sorts as $sorts) { ?>
        <?php if ($sorts['value'] == $sort . '-' . $order) { ?>
        <option value="<?php echo $sorts['href']; ?>" selected="selected"><?php echo $sorts['text']; ?></option>
        <?php } else { ?>
        <option value="<?php echo $sorts['href']; ?>"><?php echo $sorts['text']; ?></option>
        <?php } ?>
        <?php } ?>
      </select>
    </div>
  </div-->
  <!--div class="product-compare"><a href="<?php echo $compare; ?>" id="compare-total"><?php echo $text_compare; ?></a></div-->
  <div class="leftside">
  <div class="goods">
    <?php foreach ($products as $product) { ?>
    <div class="item">
      <?php if ($product['thumb']) { ?>
      <!--div class="image"--><a class="img" href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" title="<?php echo $product['name']; ?>" alt="<?php echo $product['name']; ?>" /></a><!--/div-->
      <?php } ?>
      <!--div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div-->
      <!--div class="description"><?php echo $product['description']; ?></div-->
      <?php if ($product['price']) { ?>
      <!--div class="price"-->
        <?php if (!$product['special']) { ?>
        <?php /*echo $product['price'];*/ ?>
		<a onclick="addToCart('<?php echo $product['product_id']; ?>');" class="buybtn"><?php echo '<span class="price">'.$product['price'].'</span> | <span>'.$button_cart_list.'</span>'; ?></a>
        <?php } else { ?>
        <!--span class="price-old"><?php echo $product['price']; ?></span> <span class="price-new"><?php echo $product['special']; ?></span-->
		<a onclick="addToCart('<?php echo $product['product_id']; ?>');" class="buybtn"><?php echo '<span class="price">'.$product['special'].'</span> | <span>'.$button_cart_list.'</span>'; ?></a>
        <?php } ?>
        <?php /*if ($product['tax']) { ?>
        <br />
        <span class="price-tax"><?php echo $text_tax; ?> <?php echo $product['tax']; ?></span>
        <?php }*/ ?>
      <!--/div-->
      <?php } ?>
      <?php /*if ($product['rating']) { ?>
      <div class="rating"><img src="catalog/view/theme/default/image/stars-<?php echo $product['rating']; ?>.png" alt="<?php echo $product['reviews']; ?>" /></div>
      <?php }*/ ?>
      <!--div class="cart">
        <input type="button" value="<?php echo $button_cart; ?>" onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button" />
      </div-->
      <!--div class="wishlist"><a onclick="addToWishList('<?php echo $product['product_id']; ?>');"><?php echo $button_wishlist; ?></a></div-->
      <!--div class="compare"><a onclick="addToCompare('<?php echo $product['product_id']; ?>');"><?php echo $button_compare; ?></a></div-->
    </div>
    <?php } ?>
  <div class="clear"></div>
  </div>
  <div class="pagination"><?php echo $pagination; ?></div>
  </div>
  <div class="rightcolumn">
    <?php if ($thumb || $images) { ?>
    <!--div class="left"-->
      <?php if ($thumb) { ?>
      <div class="bigimg"><div class="bigimgins"><div id="zoomin"></div><a href="<?php echo $popup; ?>" title="<?php echo $heading_title; ?>" class="cloud-zoom" id="zoom1" rel="softFocus: true, adjustX: -20, adjustY:-4, position:'left', zoomWidth:'590', zoomHeight:'430', bound:'.bigimg'"><img src="<?php echo $thumb; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" id="image" />
	  </a></div></div>
      <?php } ?>
      <?php if ($pimages) { ?>
	  <div class=" jcarousel-skin-tango">
		<div class="jcarousel-container jcarousel-container-horizontal" style="position: relative; display: block; ">
			<div class="jcarousel-clip jcarousel-clip-horizontal" style="position: relative; ">
			  <ul id="photos" class="jcarousel-skin-tango">
				<?php foreach ($pimages as $image) { ?>
				<li><a href="<?php echo $image['popup']; ?>" title="<?php echo $heading_title; ?>" class="cloud-zoom-gallery" rel="useZoom: 'zoom1', smallImage:'<?php echo $image['big']; ?>'"><img src="<?php echo $image['thumb']; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" /></a></li>
				<?php } ?>
			  </ul>
			</div>
			<div class="jcarousel-prev jcarousel-prev-horizontal" style="display: block; "></div>
			<div class="jcarousel-next jcarousel-next-horizontal" style="display: block; "></div>
		</div>
	  </div>
      <?php } ?>
    <!--/div-->
    <?php } ?>
    <!--div class="bigimg">
      <div id="zoomin"></div>
      <a href='/verstka/images/goods/shirt6_large_1.jpg' class = 'cloud-zoom' id='zoom1' rel="softFocus: true, adjustX: -20, adjustY:-4, position:'left', zoomWidth:'590', zoomHeight:'430', bound:'.bigimg'">
        <img src="/verstka/images/goods/shirt6_big_1.jpg" title="Рубаха" />
      </a>    
    </div>
    <div id="photos">
      <a href="/verstka/images/goods/shirt6_large_1.jpg" class="cloud-zoom-gallery" rel="useZoom: 'zoom1', smallImage: '/verstka/images/goods/shirt6_big_1.jpg' "><img src="/verstka/images/goods/shirt6_small_1.jpg" /></a>
      <a href="" class="cloud-zoom-gallery" rel="useZoom: 'zoom1', smallImage: '/verstka/images/goods/shirt6_big_2.jpg' "><img src="/verstka/images/goods/shirt6_small_2.jpg" /></a>
      <a href="/verstka/images/goods/shirt6_large_1.jpg" class="cloud-zoom-gallery" rel="useZoom: 'zoom1', smallImage: '/verstka/images/goods/shirt6_big_2.jpg' "><img src="/verstka/images/goods/shirt6_small_2.jpg" /></a>
      <a href="/verstka/images/goods/shirt6_large_1.jpg" class="cloud-zoom-gallery" rel="useZoom: 'zoom1', smallImage: '/verstka/images/goods/shirt6_big_2.jpg' "><img src="/verstka/images/goods/shirt6_small_2.jpg" /></a>
      <a href="/verstka/images/goods/shirt6_large_1.jpg" class="cloud-zoom-gallery" rel="useZoom: 'zoom1', smallImage: '/verstka/images/goods/shirt6_big_2.jpg' "><img src="/verstka/images/goods/shirt6_small_2.jpg" /></a>
      <div class="clear"></div>
    </div-->
    <div id="info">
     	<?php echo $heading_title; ?><br />
		<?php foreach ($attribute_groups as $attribute_group) { ?>
		<?php foreach ($attribute_group['attribute'] as $attribute) { ?>
		<strong><?php echo $attribute['name']; ?>:</strong> <?php echo $attribute['text']; ?><br />
		<?php }
		} ?>
		<?php if ($description) { ?>
		<div class="description"><strong><?php echo "Описание модели"; ?>:</strong>
		<?php echo $description; ?>
		</div>
		<?php } ?>
		<?php if ($options) { ?>
		<?php foreach ($options as $option) { ?>
		<?php if ($option['type'] == 'radio') { ?>
        <div id="option-<?php echo $option['product_option_id']; ?>" class="option">
          <?php /*if ($option['required']) { ?>
          <span class="required">*</span>
          <?php }*/ ?>
          <!--b><?php echo $option['name']; ?>:</b><br /-->
          <?php foreach ($option['option_value'] as $option_value) { ?>
          <input type="radio" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option_value['product_option_value_id']; ?>" id="option-value-<?php echo $option_value['product_option_value_id']; ?>" />
          <label for="option-value-<?php echo $option_value['product_option_value_id']; ?>"><?php echo $option_value['name']; ?>
            <?php /*if ($option_value['price']) { ?>
            (<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
            <?php }*/ ?>
          </label>
          <?php } ?>
        </div>
        <?php } 
		} 
		} 
		?>
		<input type="hidden" name="quantity" size="2" value="<?php echo $minimum; ?>" />
        <input type="hidden" name="product_id" size="2" value="<?php echo $product_id; ?>" />
		<input type="button" value="<?php echo $button_cart; ?>" id="button-cart" class="submit" />
		<!--strong>Цвет:</strong> белый<br />
		<strong>Состав:</strong> 100% хлопок<br />
		<strong>Производитель ткани:</strong> Италия<br />
		<strong>Плотность:</strong> 100 г<br />
		<strong>Описание модели:</strong> Скрагленый ворот, планка, рукава,<br />карман, манжеты.
      <form name="shirt" id="shirt" enctype="multipart/form-data" method="post" action="/">
        <input type="checkbox" value="42" name="check1" id="check1" checked="checked" /><label for="check1">42</label>
        <input type="checkbox" value="44" name="check2" id="check2" /><label for="check2">44</label>
        <input type="checkbox" value="46" name="check3" id="check3" /><label for="check3">46</label>
        <input type="checkbox" value="48" name="check4" id="check4" /><label for="check4">48</label>
        <input type="checkbox" value="50" name="check5" id="check5" /><label for="check5">50</label>
        <input type="checkbox" value="52" name="check6" id="check6" checked="checked" /><label for="check6">52</label>
        <input type="checkbox" value="60" name="check7" id="check7" /><label for="check7">60</label>
        <input class="submit" type="submit" name="submit" value="В корзину" />
      </form-->
      <div class="clear"></div>
    </div>
  </div>
  <?php } ?>
  <?php if (!$categories && !$products) { ?>
  <div class="content"><?php echo $text_empty; ?></div>
  <div class="buttons">
    <div class="right"><a href="<?php echo $continue; ?>" class="button"><?php echo $button_continue; ?></a></div>
  </div>
  <?php } ?>
  <?php echo $content_bottom; ?></div>
<script type="text/javascript"><!--
$('.colorbox').colorbox({
	overlayClose: true,
	opacity: 0.5
});
//--></script> 
<script type="text/javascript"><!--
$('#button-cart').bind('click', function() {
	$.ajax({
		url: 'index.php?route=checkout/cart/add',
		type: 'post',
		data: $('#info input[type=\'text\'], #info input[type=\'hidden\'], #info input[type=\'radio\']:checked, #info input[type=\'checkbox\']:checked, #info select, #info textarea'),
		dataType: 'json',
		success: function(json) {
			$('.success, .warning, .attention, information, .error').remove();
			
			if (json['error']) {
				if (json['error']['option']) {
					for (i in json['error']['option']) {
						$('#option-' + i).after('<span class="error">' + json['error']['option'][i] + '</span>');
					}
				}
			} 
			
			if (json['success']) {
				$('#notification').html('<div class="success" style="display: none;">' + json['success'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
					
				$('.success').fadeIn('slow');
					
				//$('#cart-total').html(json['total']);
				$('#cart .count a').html(json['total_count']);
				$('#cart .amount').html(json['total_amount']);
				
				$('html, body').animate({ scrollTop: 0 }, 'slow'); 
			}	
		}
	});
});
//--></script>
<?php /*if ($options) { ?>
<script type="text/javascript" src="catalog/view/javascript/jquery/ajaxupload.js"></script>
<?php foreach ($options as $option) { ?>
<?php if ($option['type'] == 'file') { ?>
<script type="text/javascript"><!--
new AjaxUpload('#button-option-<?php echo $option['product_option_id']; ?>', {
	action: 'index.php?route=product/product/upload',
	name: 'file',
	autoSubmit: true,
	responseType: 'json',
	onSubmit: function(file, extension) {
		$('#button-option-<?php echo $option['product_option_id']; ?>').after('<img src="catalog/view/theme/default/image/loading.gif" class="loading" style="padding-left: 5px;" />');
	},
	onComplete: function(file, json) {
		$('.error').remove();
		
		if (json.success) {
			alert(json.success);
			
			$('input[name=\'option[<?php echo $option['product_option_id']; ?>]\']').attr('value', json.file);
		}
		
		if (json.error) {
			$('#option-<?php echo $option['product_option_id']; ?>').after('<span class="error">' + json.error + '</span>');
		}
		
		$('.loading').remove();	
	}
});
//--></script>
<?php } ?>
<?php } ?>
<?php }*/ ?>
<script type="text/javascript"><!--
$('#review .pagination a').live('click', function() {
	$('#review').slideUp('slow');
		
	$('#review').load(this.href);
	
	$('#review').slideDown('slow');
	
	return false;
});			

$('#review').load('index.php?route=product/product/review&product_id=<?php echo $product_id; ?>');

$('#button-review').bind('click', function() {
	$.ajax({
		url: 'index.php?route=product/product/write&product_id=<?php echo $product_id; ?>',
		type: 'post',
		dataType: 'json',
		data: 'name=' + encodeURIComponent($('input[name=\'name\']').val()) + '&text=' + encodeURIComponent($('textarea[name=\'text\']').val()) + '&rating=' + encodeURIComponent($('input[name=\'rating\']:checked').val() ? $('input[name=\'rating\']:checked').val() : '') + '&captcha=' + encodeURIComponent($('input[name=\'captcha\']').val()),
		beforeSend: function() {
			$('.success, .warning').remove();
			$('#button-review').attr('disabled', true);
			$('#review-title').after('<div class="attention"><img src="catalog/view/theme/default/image/loading.gif" alt="" /> <?php echo $text_wait; ?></div>');
		},
		complete: function() {
			$('#button-review').attr('disabled', false);
			$('.attention').remove();
		},
		success: function(data) {
			if (data.error) {
				$('#review-title').after('<div class="warning">' + data.error + '</div>');
			}
			
			if (data.success) {
				$('#review-title').after('<div class="success">' + data.success + '</div>');
								
				$('input[name=\'name\']').val('');
				$('textarea[name=\'text\']').val('');
				$('input[name=\'rating\']:checked').attr('checked', '');
				$('input[name=\'captcha\']').val('');
			}
		}
	});
});
//--></script> 
<script type="text/javascript"><!--
$('#tabs a').tabs();
//--></script> 
<script type="text/javascript" src="catalog/view/javascript/jquery/ui/jquery-ui-timepicker-addon.js"></script> 
<script type="text/javascript"><!--
if ($.browser.msie && $.browser.version == 6) {
	$('.date, .datetime, .time').bgIframe();
}

$('.date').datepicker({dateFormat: 'yy-mm-dd'});
$('.datetime').datetimepicker({
	dateFormat: 'yy-mm-dd',
	timeFormat: 'h:m'
});
$('.time').timepicker({timeFormat: 'h:m'});
//--></script> 


<script type="text/javascript"><!--
function display(view) {
	if (view == 'list') {
		$('.product-grid').attr('class', 'product-list');
		
		$('.product-list > div').each(function(index, element) {
			html  = '<div class="right">';
			html += '  <div class="cart">' + $(element).find('.cart').html() + '</div>';
			html += '  <div class="wishlist">' + $(element).find('.wishlist').html() + '</div>';
			html += '  <div class="compare">' + $(element).find('.compare').html() + '</div>';
			html += '</div>';			
			
			html += '<div class="left">';
			
			var image = $(element).find('.image').html();
			
			if (image != null) { 
				html += '<div class="image">' + image + '</div>';
			}
			
			var price = $(element).find('.price').html();
			
			if (price != null) {
				html += '<div class="price">' + price  + '</div>';
			}
					
			html += '  <div class="name">' + $(element).find('.name').html() + '</div>';
			html += '  <div class="description">' + $(element).find('.description').html() + '</div>';
			
			var rating = $(element).find('.rating').html();
			
			if (rating != null) {
				html += '<div class="rating">' + rating + '</div>';
			}
				
			html += '</div>';

						
			$(element).html(html);
		});		
		
		$('.display').html('<b><?php echo $text_display; ?></b> <?php echo $text_list; ?> <b>/</b> <a onclick="display(\'grid\');"><?php echo $text_grid; ?></a>');
		
		$.cookie('display', 'list'); 
	} else {
		$('.product-list').attr('class', 'product-grid');
		
		$('.product-grid > div').each(function(index, element) {
			html = '';
			
			var image = $(element).find('.image').html();
			
			if (image != null) {
				html += '<div class="image">' + image + '</div>';
			}
			
			html += '<div class="name">' + $(element).find('.name').html() + '</div>';
			html += '<div class="description">' + $(element).find('.description').html() + '</div>';
			
			var price = $(element).find('.price').html();
			
			if (price != null) {
				html += '<div class="price">' + price  + '</div>';
			}
			
			var rating = $(element).find('.rating').html();
			
			if (rating != null) {
				html += '<div class="rating">' + rating + '</div>';
			}
						
			html += '<div class="cart">' + $(element).find('.cart').html() + '</div>';
			html += '<div class="wishlist">' + $(element).find('.wishlist').html() + '</div>';
			html += '<div class="compare">' + $(element).find('.compare').html() + '</div>';
			
			$(element).html(html);
		});	
					
		$('.display').html('<b><?php echo $text_display; ?></b> <a onclick="display(\'list\');"><?php echo $text_list; ?></a> <b>/</b> <?php echo $text_grid; ?>');
		
		$.cookie('display', 'grid');
	}
}

view = $.cookie('display');

if (view) {
	display(view);
} else {
	display('grid');
}
//--></script> 
<?php echo $footer; ?>